

const {ccclass, property} = cc._decorator;

@ccclass
export default class JYHY_baojinbi_01 extends cc.Component {
    @property(cc.Node)
    pn_body :cc.Node = null;
    @property(cc.ParticleSystem)
    ps_1:cc.ParticleSystem  = null;
    @property(cc.ParticleSystem)  
    ps_2:cc.ParticleSystem  = null;

    _ani:any = null;
    _ani_state:any = null;
    onLoad(){
        this._ani = this.pn_body.getComponent(cc.Animation);
        this._ani_state = this._ani.getAnimationState(this._ani.defaultClip.name);
        
    }

    hide(){
        this.node.active = false;
    }

    show(){
        this.node.active = true;
    }

    setCb(cb){
        if(cb)
            this._ani.on('finished',  cb,    this);
    }

    playAni(){
        
        this.pn_body.active = true;

        if(this._ani_state&&!this._ani_state.isPlaying){
            this._ani.play();
            this.ps_1.resetSystem();
            this.ps_2.resetSystem();
        }  
    }
}
